package br.com.lavitstudio.game;

import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;

public class BlockGravity extends Rectangle {
	private static final long serialVersionUID = 1L;

	public BlockGravity(int x, int y, int width, int height){
		setBounds(x, y, width, height);
	}
	
	public void tick() {

	}
	
	public void render(Graphics g) {

	}
	
	public boolean isCollidingWithBlock(Point pt1, Point pt2) {
		for(int x=(int) (this.x/Tile.tileSize); x<(int) (this.x/Tile.tileSize + 3); x++){
			for(int y=(int) (this.y/Tile.tileSize); y<(int) (this.y/Tile.tileSize + 3); y++){
				if(x >= 0 && y >= 0 && x < Level.block.length && y < Level.block[0].length)
				if(Level.block[x][y].id != Tile.block.get("air")) {
					if(Level.block[x][y].contains(pt1) || Level.block[x][y].contains(pt2)) {
						return true;
					}
				}
			}			
		}
		return false;
	}
}
